#include "ButtonsContainerWidget.h"

ButtonsContainerWidget::ButtonsContainerWidget()
{
    MainLayout = new QVBoxLayout();
    setLayout( MainLayout );
}

ButtonsContainerWidget::ButtonsContainerWidget( const QVector<QString> titles )
{
    MainLayout = new QVBoxLayout();
    setLayout( MainLayout );

    for (int i=0; i<titles.size(); i++){
        buttons.push_back( 0 );
        buttons[i] = new QPushButton( titles[i] );
        MainLayout->addWidget( buttons[i] );
    }
}

ButtonsContainerWidget::~ButtonsContainerWidget()
{
    delete MainLayout;
}

void ButtonsContainerWidget::AddButton( const QString title )
{
    buttons.push_back( 0 );
    buttons[ buttons.size() - 1 ] = new QPushButton( title );
    MainLayout->addWidget( buttons[ buttons.size() - 1 ] );
}

QPushButton* ButtonsContainerWidget::GetButton( int index ) const
{
    if ( index < 0 || index >= buttons.size() )
        return 0; else
            return buttons[index];
}

void ButtonsContainerWidget::AddStretch()
{
    MainLayout->addStretch();
}


//*****************************************************************//
//************************* ORDER BUTTONS *************************//

OrderButtonsWidget::OrderButtonsWidget() : ButtonsContainerWidget()
{
    AddButton( tr("Add Order") );
    AddButton( tr("Remove Order") );
    AddButton( tr("Edit Order") );
    AddButton( tr("Pause Order") );
    AddButton( tr("Renew Order") );
    AddButton( tr("Print Wantage") );
    AddStretch();
}

//************************* ORDER BUTTONS *************************//
//*****************************************************************//


//*****************************************************************//
//************************* INCOME BUTTONS ************************//

IncomeButtonsWidget::IncomeButtonsWidget() : ButtonsContainerWidget()
{
    AddButton( tr("Add Income") );
    AddButton( tr("Remove Income") );
    AddButton( tr("Edit Income") );
    AddButton( tr("Pause Income") );
    AddButton( tr("Renew Income") );
    AddStretch();
}

//************************* INCOME BUTTONS ************************//
//*****************************************************************//


//*****************************************************************//
//************************* STOCK BUTTONS *************************//

StockButtonsWidget::StockButtonsWidget() : ButtonsContainerWidget()
{
    AddButton( tr("Add Item") );
    AddButton( tr("EditItem") );
    AddButton( tr("Remove Item") );
    AddButton( tr("Print database") );
    AddStretch();
}

//************************* STOCK BUTTONS *************************//
//*****************************************************************//
